<template>
  <div id="myheader">
    <img :src="imgSrc" alt="">
  </div>
</template>

<script type="text/ecmascript-6">
/* eslint-disable*/
import mixin from "@/common/js/mixin.js";
import { raceShow } from "@/api/raceshow.js";
import { indexedDB } from "@/api/indexedDB.js";
import Bus from "@/common/js/bus.js";

export default {
  props: ["page"],
  data() {
    return {
      raceid: 0,
      imgSrc: ""
    };
  },
  created() {
    var _this=this;
    Bus.$on("raceInfo", e => {
      //_this.$set(this, "raceInfo", e);
      //console.log(e)
      //console.log(this.raceInfo);
      //_this.raceInfo=e
      //window.localStorage.getItem
      //console.log(e.header)
      e.header.indexOf('?imageView2')==-1?_this.imgSrc = `${e.header}?imageView2/2/w/850/q/100`:_this.imgSrc=e.header
      //if(e.header.indexOf('?imageView2')
       //_this.imgSrc = e.header;
    });

    //console.log(this.raceinfo);

    // this.raceid = this.page.raceid;
    // let _this = this;
    // raceShow(`${window.host}race/show`, {
    //   raceid: this.raceid
    // }).then(response => {
    //   if (response.data.code == 200) {
    //     _this.imgSrc = response.data.data.header;
    //     let data = response.data.data;
    //     indexedDB("raceInfo", "set", this.RACEID, data, function() {});
    //   }
    // });
  },
  mounted() {
    //console.log(this.raceinfo);
  }
};
</script>


<style lang="less" rel="stylesheet/less">
#myheader img {
  width: 100%;
  max-width: 850px;
}
</style>
